<%@page contentType="text/html;charset=utf-8"%>
<%@ taglib prefix="cw" uri="/widget-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<cw:base />
		<script type="text/javascript">
		</script>
	</head>
	<body>
		<li>
			<b>表单交互失败的示例，交互失败原因有两种：</b>
		</li>
		<li>
			<b>一种请求时间过长造成无法数据加载或者提交，可以通过表单属性timeout来延长交互时间限制(默认为30s，此方法不推荐)</b>
		</li>
		<li>
			<b>一种是后台需要抛出业务异常阻止交互继续，比如超过登记次数时，不允许提交到后台</b>
		</li>
		<cw:form id="form" url="../../../../sample/form/ajaxSubmitFailed.action" waitMsg="提交中...">
			姓名：<cw:text property="name" />
			<br>
			<li>
				请求时间过长造成无法数据加载
				<table>
					<tr>
						<td>
							<cw:button text="加载超时 " onclick="lazyLoad()"></cw:button>
						</td>
					</tr>
				</table>
				<br>
			</li>
			<li>
				数据有误，后台抛出异常阻止数据加载
				<table>
					<tr>
						<td>
							<cw:button text="加载失败 " onclick="loadFail()"></cw:button>
						</td>
					</tr>
				</table>
				<br>
			</li>
			<li>
				某种限制，后台抛出异常阻止数据提交
				<table>
					<tr>
						<td>
							<cw:formButton actionType="submit" formId="form" text="提交失败" />
						</td>
					</tr>
				</table>
				<br>
			</li>
		</cw:form>
		<script type="text/javascript">
		    function lazyLoad(){
		        Wonders.utils.formLoad('form','../../../../sample/form/loadForm.action',{'lazy':'true'},null,'加载成功');
		    }
		        
		    function loadFail(){
		        Wonders.utils.formLoad('form','../../../../sample/form/loadFormFailed.action',{'id' :'1'});
		    }
		        
				cf_r(function(){
				    Wonders.utils.formLoad('form','../../../../sample/form/loadForm.action',{'id' :'1'});
				});
		</script>
	</body>
	<cw:theme></cw:theme>
</html>
